package com.crazyhat.crazyhat.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.crazyhat.crazyhat.entity.AdminMessage;
import com.crazyhat.crazyhat.pojo.Result;
import com.crazyhat.crazyhat.service.IAdminMessageService;

/**
 * <p>
 * 给系统管理员的消息 前端控制器
 * </p>
 *
 * @author crazyhat
 * @since 2024-07-05
 */
@RestController
@RequestMapping("/adminMessage")
public class AdminMessageController {

    @Autowired
    IAdminMessageService adminMessageService;

    /**
     * 查看消息
     */
    @GetMapping("/checkMassages")
    public Result<Page<AdminMessage>> checkMassages(@RequestParam int pageNum, @RequestParam int pageSize) {

        Page<AdminMessage> adminMessagePage =adminMessageService.checkMassages(pageNum, pageSize);
        return Result.success(adminMessagePage);
    }

    @GetMapping("/getMessage")
    public Result getMessage(@RequestParam int clubId) {
        AdminMessage adminMessage=adminMessageService.getMessage(clubId);
        return Result.success(adminMessage);
    }
}
